<template>
	<MkDialog ref="dialogRef" title="检验套餐编辑" @submit="closeDialog">
		<MkForm>
			<MkInput v-model="form.id" label="ID" />
			<MkInput v-model="form.name" label="检验套餐分组名称" />
			<MkInput v-model="form.group" label="互扫分组" />
			<MkInput v-model="form.defaultPackage" label="互扫默认套餐" />
			<MkInput v-model="form.prefix" label="自编号前缀" />
			<el-form-item label="是否启用自定自编号">
				<el-switch v-model="form.autoNumber" size="large" active-text="是" inactive-text="否" />
			</el-form-item>
			<el-form-item label="未检验能否直接审核">
				<el-switch v-model="form.directAudit" size="large" active-text="是" inactive-text="否" />
			</el-form-item>
			<MkInput v-model="form.sort" label="排序" />
			<el-form-item label="是否启用">
				<el-switch v-model="form.isEnabled" size="large" active-text="启用" inactive-text="禁用" />
			</el-form-item>
		</MkForm>
	</MkDialog>
</template>
<script lang="ts" setup>
/**
 * 表单数据
 */
const form = ref({
	id: '',
	name: '',
	group: '',
	defaultPackage: '',
	prefix: '',
	autoNumber: false,
	directAudit: false,
	sort: '',
	isEnabled: false,
});
/**
 * 弹窗逻辑
 */
const dialogRef = ref();
const showDialog = (item: any) => {
	form.value = {
		id: '',
		name: '',
		group: '',
		defaultPackage: '',
		prefix: '',
		autoNumber: false,
		directAudit: false,
		sort: '',
		isEnabled: false,
	};
	dialogRef.value.show();
};
const closeDialog = () => {
	dialogRef.value.close();
};

defineOptions({
	name: 'EditDialog',
});
defineExpose({ showDialog, closeDialog });
</script>
